#!/usr/bin/env python
# -*- coding: utf-8 -*-

""" By Martin Senande-Rivera
    For Towards and atmosphere more favourable to firestorm development in Europe """

import os
import glob, sys
import numpy as np
import xarray as xr
import pandas as pd

path_dmp='./DMP/Monthly_mean/'
path_outs='./'

# Read files
DMP = xr.open_mfdataset(path_dmp+'DMP_*.nc',concat_dim='time')['DMP']
DMP.values[DMP.values==-0.02]=np.nan

# DMP mean
DMP_mean = DMP.mean(dim='time',skipna=True)
DMP_mean.to_netcdf(ruta_dmp+'DMP_mean.nc')   # Save output



